package com.atguigu.yygh.model.hosp;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.yygh.model.base.BaseMongoEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * <p>
 * Hospital
 * </p>
 *
 * @author qy
 */
@Data
@ApiModel(description = "Hospital")
@Document("Hospital")
public class Hospital extends BaseMongoEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "医院编号")
    // Spring Data MongoDB 3.X 后的版本不再支持自动创建索引，如果要坚持使用@Indexed注解需要额外的设置，建议手动创建索引。
    //	@Indexed(unique = true) 自动创建唯一索引
    private String hoscode;

    @ApiModelProperty(value = "医院名称")
    //	@Indexed //自动创建普通索引
    private String hosname;

    @ApiModelProperty(value = "医院类型")
    private String hostype;

    @ApiModelProperty(value = "省code")
    private String provinceCode;

    @ApiModelProperty(value = "市code")
    private String cityCode;

    @ApiModelProperty(value = "区code")
    private String districtCode;

    @ApiModelProperty(value = "详情地址")
    private String address;

    @ApiModelProperty(value = "医院logo")
    private String logoData;

    @ApiModelProperty(value = "医院简介")
    private String intro;


    @ApiModelProperty(value = "坐车路线")
    private String route;

    @ApiModelProperty(value = "状态 0：未上线 1：已上线")
    private Integer status;

    //预约规则
    @ApiModelProperty(value = "预约规则")
    private BookingRule bookingRule;

    /**
     * 将 json 转为 Bean
     *
     * @param bookingRule
     */
    public void setBookingRule(String bookingRule) {
        this.bookingRule = JSONObject.parseObject(bookingRule, BookingRule.class);
    }

}

